package com.zsrt.java.day20161226.wrl.day161226.demo12;

public class ArrayDemo02 {
	public static void main(String[] args) {
		int[] ages = new int[3];
		ages[0] = 23;
		ages[1] = 18;
		ages[2] = 16;
		int len = ages.length;
		
		for(int index=0;index<=len-1;index++){
			int value = ages[index];
			if (index == len-1) {
				System.out.print(value);
				break;
			}
			System.out.print(value+" , ");
		}
		
		System.out.println("\n--------逆序输出--------");
		for(int index=len-1;index>=0;index--){
			int value = ages[index];
			if (index == 0) {
				System.out.print(value);
			}else{
				System.out.print(value+" , ");
			}
		}
	}

}
